package cn.njxzc.exercises;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class Pro8_2 {
	private String idString;
	private String nameString;
	private int phoneNumber;

	Pro8_2(String aId, String aName, int phone) {
		idString = aId;
		nameString = aName;
		phoneNumber = phone;

	}

	public String toString() {
		return (idString + ":" + nameString + ":" + phoneNumber);
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Map students= new TreeMap();
		Pro8_2 s1=new Pro8_2("001","小王", 2345656);
		students.put(s1.idString, s1);
		Pro8_2 s2=new Pro8_2("002","张华", 7678922);
		students.put(s2.idString, s2);
		
		Set keys=students.keySet();
		Iterator it=keys.iterator();
		Pro8_2 s;
		String key;
		while (it.hasNext()) {
			key=(String)it.next();
			System.out.println(students.get(key));
		}
		// Map resultMap = sortMapByKey(map); //��Key��������

		// for (Map.Entry<String, String> entry : resultMap.entrySet()) {
		// System.out.println(entry.getKey() + " " + entry.getValue());
		// }

	}
}